package io.github.wanggit.antrpc.zipkin.dependencies.rest;

import io.github.wanggit.antrpc.zipkin.dependencies.service.DependenciesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping
public class DependencyResource {

    @Autowired private DependenciesService dependenciesService;

    @GetMapping("dependency")
    public String doIt(String yyyyMMdd) {
        try {
            dependenciesService.apply(yyyyMMdd);
        } catch (Exception e) {
            return "ERROR: " + e.getMessage();
        }
        return "OK";
    }
}
